package Buttons 
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import screens.NoteCanvas;
	
	/**
	 * ...
	 * @author Andy Wolff
	 */
	public class PlayButton extends MovieClip
	{
		static public var TOBEGINNING:int, REWIND:int, PLAY:int, FASTFORWARD:int, TOEND:int, UNDO:int, REDO:int;
		private var view:NoteCanvas;
		private var which:int;
		private var held:Boolean=false;
		public function PlayButton(view:NoteCanvas,which:int) 
		{
			this.view = view;
			this.which = which;
			addEventListener(MouseEvent.CLICK, click);
			addEventListener(MouseEvent.MOUSE_DOWN, down);
			addEventListener(MouseEvent.MOUSE_UP, up);
			addEventListener(Event.ENTER_FRAME, step)
			addEventListener(MouseEvent.MOUSE_OUT, up);
		}
		
		public function click(me:MouseEvent):void {
			view.buttonPressed(which);
		}
		
		public function down(me:MouseEvent):void {
			held = true;
		}
		
		public function up(me:MouseEvent):void {
			held = false;
		}
		
		public function step(e:Event):void {
			if (held) view.buttonHeld(which);
		}
	}

}